package com.lemon.tuvi2015;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AlphaAnimation;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.lemon.tuvi2015.util.TagName;
import com.lemon.tuvi2015.view.CustomActionbar;
import com.lemon.tuvi2015.view.RippleLayout;

public class HoroscopeActivity extends Activity {

	String Aries = "Bạch Dương";
	String Taurus = "Bạch Dương";
	String Gemini = "Song Tử";
	String Cancer = "Cự Giải";
	String Leo = "Sư Tử";
	String Virgo = "Xử Nữ";
	String Libra = "Thiên Bình";
	String Scorpio = "Hổ Cáp";
	String Sagittarius = "Nhân Mã";
	String Capricornus = "Ma Kết";
	String Aquarius = "Bảo Bình";
	String Pisces = "Song Ngư";

	RippleLayout actionLeft, actionRight;
	TextView textTitle;
	String[] cunghoangdao = { Aries, Taurus, Gemini, Cancer, Leo, Virgo, Libra, Scorpio, Sagittarius, Capricornus, Aquarius, Pisces };
	String[] cunghoangdaoContent;

	CustomActionbar actionbar;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.horoscope_layout);
		cunghoangdaoContent = getResources().getStringArray(R.array.cunghoangdao);
		// actionLeft=(RippleLayout) findViewById(R.id.action_left);
		// actionLeft.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View v) {
		// onBackPressed();
		// }
		// });
		// ((TextView)
		// findViewById(R.id.action_title)).setText(getResources().getString(R.string.home_menu_horoscope));

		((Button) findViewById(R.id.btn_Aries)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Aquarius)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Cancer)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Capricornus)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Gemini)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Leo)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Libra)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Pisces)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Sagittarius)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Scorpio)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Taurus)).setOnClickListener(clickListener);
		((Button) findViewById(R.id.btn_Virgo)).setOnClickListener(clickListener);
		initActionbar();
	}

	void initActionbar() {
		actionbar = (CustomActionbar) findViewById(R.id.header);
		OnClickListener listenerBack = new OnClickListener() {

			@Override
			public void onClick(View v) {
				onBackPressed();
			}
		};
		actionbar.setActionbar(R.string.home_menu_horoscope, listenerBack, null);
	}

	OnClickListener clickListener = new OnClickListener() {

		@Override
		public void onClick(View view) {
			final AlphaAnimation buttonClick = new AlphaAnimation(1F, 0.6F);
			view.startAnimation(buttonClick);
			switch (view.getId()) {
			case R.id.btn_Aries:
				// Toast.makeText(getApplicationContext(), "Aries",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(0);
				break;
			case R.id.btn_Taurus:
				// Toast.makeText(getApplicationContext(), "Taurus",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(1);
				break;
			case R.id.btn_Gemini:
				// Toast.makeText(getApplicationContext(), "Gemini",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(2);
				break;
			case R.id.btn_Cancer:
				// Toast.makeText(getApplicationContext(), "Cancer",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(3);
				break;
			case R.id.btn_Leo:
				// Toast.makeText(getApplicationContext(), "Leo",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(4);
				break;
			case R.id.btn_Virgo:
				// Toast.makeText(getApplicationContext(), "Virgo",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(5);
				break;
			case R.id.btn_Libra:
				// Toast.makeText(getApplicationContext(), "Libra",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(6);
				break;
			case R.id.btn_Scorpio:
				// Toast.makeText(getApplicationContext(), "Scorpio",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(7);
				break;
			case R.id.btn_Sagittarius:
				// Toast.makeText(getApplicationContext(), "Sagittarius",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(8);
				break;
			case R.id.btn_Capricornus:
				// Toast.makeText(getApplicationContext(), "Capricornus",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(9);
				break;
			case R.id.btn_Aquarius:
				// Toast.makeText(getApplicationContext(), "Aquarius",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(10);
				break;
			case R.id.btn_Pisces:
				// Toast.makeText(getApplicationContext(), "Pisces",
				// Toast.LENGTH_SHORT).show();
				startDetailsActivity(11);
				break;
			default:
				break;
			}

		}
	};

	void startDetailsActivity(int index) {
		// Intent intent = new Intent(HoroscopeActivity.this,
		// HoroscopeDetailsActivity.class);
		// intent.putExtra(TagName.TITLE, cunghoangdao[index]);
		// intent.putExtra(TagName.KEY, cunghoangdaoContent[index]);
		// startActivity(intent);
		Intent intent = new Intent(HoroscopeActivity.this, HoroscopeDetailsActivity.class);
		// intent.putExtra(TagName.TITLE, cunghoangdao[index]);
		intent.putExtra(TagName.KEY, index);
		startActivity(intent);
	}
}
